package cn.itcast.bos.service;

import java.util.Date;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.springframework.context.annotation.Conditional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import cn.itcast.bos.domain.page.PageBean;
import cn.itcast.bos.domain.take_delivery.Promotion;

public interface PromotionService {

	void save(Promotion model);

	Page<Promotion> findPageQuery(Pageable pageable);

	// WebService方法，获取宣传活动数据
	@Path("/findPageData")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public PageBean<Promotion> findPageData(@QueryParam("page") Integer page,@QueryParam("rows")Integer rows);

	// WebService方法，获取宣传活动数据
	@Path("/findById/{id}")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public Promotion findById(@PathParam("id") Integer id);
	
	/**每分钟执行一次，当前时间大于Promotion表的endDate字段的时间，说明该活动已经过去，需要更新status = '2'*/
	public void updateStatus(Date date);
}